const path = require("path");
const express = require("express");
const app = express();

// 设置响应头
app.use(express.json());
app.use(express.urlencoded({ extended: true }));

// 静态服务
app.use("/static", express.static("static"));
// 设置模版引擎及模版位置
app.set("view engine", "ejs");
app.set("views", path.join(__dirname, "views"));

app.get("/", function (req, res) {
    res.render("index");
});

app.get("/login", function (req, res) {
    const query = req.query;
    res.render("login");
});

app.listen(3000, function () {
    console.log("Listening on port 3000...");
});
